package com.clms.rents.config;

import com.clms.common.util.RsaUtils;
import lombok.Data;
import org.springframework.boot.context.properties.ConfigurationProperties;

import javax.annotation.PostConstruct;
import java.security.PrivateKey;
import java.security.PublicKey;

/**
 * @program: clms-third
 * @description: 公钥私钥配置类
 * @author: 杨浩
 * @create: 2021-07-17 15:02
 **/
@Data
@ConfigurationProperties(prefix = "clms.third")
public class RsaKeyProperties {
    private String pubKeyPath;
    private String prikeyPath;
    private PublicKey publicKey;
    private PrivateKey privateKey;
    @PostConstruct
   public void loadkey()throws Exception{
        publicKey= RsaUtils.getPublicKey(pubKeyPath);
        privateKey=RsaUtils.getPrivateKey(prikeyPath);
    }
}
